package ab.mes.controller;

import ab.mes.entity.firstCheckRecords;
import ab.mes.service.firstCheckRecordsService;
import ab.mes.tools.Result;
import ab.mes.tools.firstCheckRecordsConditions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/firstCheckRecords")
public class firstCheckRecordsController {
    @Autowired
    private firstCheckRecordsService firstCheckRecordsService;

    @PostMapping("/selectAll")
    //查询所有首件检查历史记录
    public Result selectAll(){
        Result result=new Result();
        try {
            result = firstCheckRecordsService.selectAll();
        }catch (Exception e){
            result.setErrorMessage("查询首件检测记录失败！");
            e.printStackTrace();
        }
        return result;
    }

    @PostMapping("/select1")
    //根据起止日期、订单编号、生产序号查询首件检查历史记录
    public Result select1(@RequestBody firstCheckRecordsConditions conditions){
        Result result=new Result();
        try {
            result = firstCheckRecordsService.select1(conditions);
        }catch (Exception e){
            result.setErrorMessage("查询首件检测记录失败！");
            e.printStackTrace();
        }
        return result;
    }
}
